#!/usr/bin/env python
#coding=utf-8
import sys,os,datetime
os.environ['DJANGO_ORM_SETTINGS_MODULE'] = 'settings'

from ttorm.db import models

MailState = {-1 : '删除', 0 : '正常', 1 : '重要'}

class Mail(models.Model):
    name = models.EmailField('邮箱', unique=True)
    postdate = models.DateField('更新日期', auto_now=True)
    state = models.IntegerField('状态', choices=MailState.items(), default=0, blank=True)
    
    def __unicode__(self):
        return self.name
    
    def delete(self):
        self.state = -1
        self.save()
        
    class Meta:
        db_table = 'mail'


if __name__ == '__main__':
    from ttorm.core import management as m
    m.call_command('syncdb')